#include"progress.h"

typedef void (*call_back) (double current,double total);//函数指针
double total=1024.0;
double speed=1.0;

void progress_v2(call_back cb)
{
  double current=0;
  while(current<=total)
  {
    cb(current,total);
    fflush(stdout);
    usleep(3000);
    current+=speed;
  }
  printf("\nDownload ... %lf done!\n",current);
}
//回调函数
void Upload(call_back cb)
{
  double current=0;
  while(current<=total)
  {
    cb(current,total);
    fflush(stdout);
    usleep(3000);
    current+=speed;
  }
  printf("\nDownload ... %lf done!\n",current);
}
int main()
{
  progress_v2(progressbar);
  progress_v2(progressbar);
  progress_v2(progressbar);
  progress_v2(progressbar);
 //progress_v1();
  return 0;
}
